package com.iscas.dataaggregation.strategy;

import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class ChaosFaultTypeContext {
    private static final Map<String, ChaosFaultTypeStrategy> strategyMap = new HashMap<>();

    // 静态块初始化策略
    static {
        strategyMap.put("HTTPChaos", new HttpChaosStrategy());
        strategyMap.put("StressChaos", new StressChaosStrategy());
        strategyMap.put("Default", new DefaultChaosStrategy());
    }

    public static ChaosFaultTypeStrategy getStrategy(String chaosType) {
        return strategyMap.getOrDefault(chaosType, new DefaultChaosStrategy());
    }
}
